package com.atguigu.daijia.order.service;

import com.atguigu.daijia.model.entity.order.OrderInfo;
import com.atguigu.daijia.model.form.order.OrderInfoForm;
import com.atguigu.daijia.model.form.order.StartDriveForm;
import com.atguigu.daijia.model.form.order.UpdateOrderBillForm;
import com.atguigu.daijia.model.form.order.UpdateOrderCartForm;
import com.atguigu.daijia.model.vo.base.PageVo;
import com.atguigu.daijia.model.vo.order.CurrentOrderInfoVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;

public interface OrderInfoService extends IService<OrderInfo> {

    /**
     * 保存订单相关信息
     * @param orderInfoForm
     * @return
     */
    Long saveOrder(OrderInfoForm orderInfoForm);

    void saveOrderStatusLogs(Long id, Integer status);

    Integer getOrderStatus(Long orderId);

    /**
     * 司机抢单
     * @param driverId
     * @param orderId
     * @return
     */

    Boolean robNewOrder(Long driverId, Long orderId);

    /**
     * 查询用户当前订单
     * @param customerId
     * @return
     */
    CurrentOrderInfoVo searchCustomerCurrenOrder(Long customerId);

    /**
     * 查询司机当前订单
     * @param customerId
     * @return
     */
    CurrentOrderInfoVo searchDriverCurrentOrder(Long customerId);

    Boolean driverArriveStartLocation(Long orderId, Long driverId);

    Boolean updateOrderCart(UpdateOrderCartForm updateOrderCartForm);

    Boolean startDriver(StartDriveForm startDriveForm);

    /**
     * 根据时间段获取司机订单数量
     * @param startTime
     * @param endTime
     * @return
     */
    Long getOrderNumByTime(String startTime, String endTime);

    /**
     * 结束订单服务
     * @param updateOrderBillForm
     * @return
     */
    Boolean endDrive(UpdateOrderBillForm updateOrderBillForm);

    /**
     * 查询顾客订单分页
     * @param pageParam
     * @param customerId
     * @return
     */
    PageVo findCustomerOrderPage(Page<OrderInfo> pageParam, Long customerId);

    PageVo findDriverOrderPage(Page<OrderInfo> pageParam, Long driverId);
}
